#include "Bonus.h"


Bonus::Bonus()
{
}

Bonus::Bonus(int x, int y, const std::string message)
: SpriteText(BONUS_TEXT_PATH, TTF_STYLE_NORMAL, message, BONUS_TEXT_SIZE, x, y)
, bonus(5000)
, currentTime(0)
, gameOver(false)
{
}

void Bonus::Update(float dt)
{
	if (!gameOver && bonus != 0)
	{
		currentTime += dt;
		if (currentTime >= TIME_BONUS)
		{
			bonus -= 10;
			
			currentTime -= TIME_BONUS;
		}
	}
	std::stringstream ss;
	ss << std::setfill('0') << std::setw(4) << bonus;
	SetMessage(ss.str());
}

void Bonus::SubstractPoints(int points)
{
	bonus -= points;
}

Bonus::~Bonus()
{
}
